package him.serviceimple;

import java.util.List;

import him.dao.MemberDAO;
import him.daoimple.MemberDAOImple;
import him.dto.coursemanage.CoursestuDTO;
import him.dto.login.LoginDTO;
import him.dto.member.ApplicationDTO;
import him.dto.member.MemberDTO;
import him.service.MemberService;

public class MemberServiceImple implements MemberService {

	private MemberDAO memberDAO;
	private static MemberServiceImple memberService;
	
	private MemberServiceImple(){
		memberDAO = new MemberDAOImple();
	}
	
	public static MemberServiceImple getInstance(){
		if (memberService==null) {
			memberService=new MemberServiceImple();
		}
		return memberService;
	}
	@Override
	public boolean insertMember(MemberDTO memberDTO, List<ApplicationDTO> appList,
			CoursestuDTO coursestuDTO, LoginDTO loginDTO) {
		boolean isM = memberDAO.insertMember(memberDTO);
		boolean isA = memberDAO.insertApplication(appList);
		boolean isC = memberDAO.insertCourseStu(coursestuDTO);
		boolean isL = memberDAO.insertLogin(loginDTO);
		return isM==true && isA==true && isC==true && isL==true? true:false;
	}

}
